/**
 * 请求删除设备
 * 需要先运行后台
 */

var http = require('http');
var querystring = require('querystring');

var post_data={
    'devName':'door',
    'mac' : '4E:20:04:11:76:56', //这个根据实际设备更改
    'outCh':'4',
    'inCh':'4'
}//这是需要提交的数据 

var content=JSON.stringify(post_data);//推送的数据为JSON

var options = {
    port : 8866,
    path: '/dev/deldev',
    headers:{
        'Content-Type': 'application/json',
        'Content-Length': content.length
    }
};


var req = http.request(options,function(res){
    console.log('STATUS:' + res.statusCode);
    console.log('HEADERS:' + JSON.stringify(res.headers));
    res.setEncoding('utf8');
    res.on('data',function(chunk){
        console.log('Body:' + chunk);
    });
});

req.on('error',function(err){
    console.log('problem with request:' + err.message);
});

req.write(content);
req.end();

